<?php
	/**
	 * 设备启动
	 */
    class DeviceBoot extends APIBase {
		
		public $tag = "DeviceBoot";
		public $isLogin = false;
		
		
		public function before() {
			$this->initMysql();
			$this->initCacheRedis();
			$this->initDataRedis(0);
			$this->inithttp();
			return true;
		}
	
		public function logic() {
            $cid = '10004';
			$imei = $this->param['imei'];//设备编号
			$platform_type = $this->param['platform_type'];//平台类型
			$start_time = time();
			$ip = $this->getRealIp(); 
			$channel = 1;//渠道编号
			$agent = '';//代理商
			
			
			if((!isset($imei) && $imei=='') || (!isset($platform_type) && $platform_type=='')){
				$this->returnError('301','参数错误!');
			}
			$param = array('data'=>array(array('cid'=>$cid,'imei'=>(string)$imei,'start_time'=>$start_time,'ip'=>$ip,'channel'=>(int)$channel,'agent'=>$agent,'platform_type'=>$platform_type)));
			
			Data_report('fdip',$param);
	    }
	   


    	public function after() {
    		$this->deinitDataRedis();
			$this->deinitCacheRedis();
			$this->deinitMysql();
			$this->deinithttp();
		}
    }
?>
